<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PokemonMS β - ${convention.conventionName}</title>
<jsp:include page="/WEB-INF/view/common/head_meta.jsp"></jsp:include>
<link rel="stylesheet" type="text/css" href="${f:url('/css/flexigrid/flexigrid.css')}"/>
<script type="text/javascript" src="${f:url('/js/jquery-1.4.2.min.js')}"></script>
<script type="text/javascript" src="${f:url('/js/flexigrid.js')}"></script>
<script type="text/javascript">
<!--
$(function(){
	$('#convention_members').flexigrid(
	{
	colModel : [
			{display: 'メンバー名', name : 'memberName', width : 220, sortable : true, align: 'left'},
			{display: 'ともだちコード', name : 'friendCode', width : 180, sortable : true, align: 'left'},
			],
	height: 'auto',
	width: 'auto'
	});
});

$(function(){
	$('#convention_rank').flexigrid(
	{
	colModel : [
			{display: '順位', name : 'rank', width : 20, sortable : true, align: 'center'},
			{display: 'メンバー名', name : 'memberName', width : 120, sortable : true, align: 'left'},
			{display: '勝利数', name : 'winCount', width : 40, sortable : true, align: 'right'}
			],
	height: 'auto',
	width: 'auto'
	});
});

$(function(){
	$('#during_battle_convention_logs').flexigrid(
	{
	colModel : [
			{display: 'マッチ', name : 'memberName', width : 410, sortable : true, align: 'left'},
			],
	height: 'auto',
	width: 'auto'
	});
});

$(function(){
	$('#end_battle_convention_logs').flexigrid(
	{
	colModel : [
			{display: '対戦結果', name : 'battleResult', width : 360, sortable : true, align: 'left'}
			],
	height: 'auto',
	width: 'auto'
	});
});

function showPlagin(idno){
	pc = ('PlagClose' + (idno));
	po = ('PlagOpen' + (idno));
	if( document.getElementById(pc).style.display == "none" ) {
		document.getElementById(pc).style.display = "block";
		document.getElementById(po).style.display = "none";
	}
	else {
		document.getElementById(pc).style.display = "none";
		document.getElementById(po).style.display = "block";
	}
}
// -->
</script>
</head>
<body>
<jsp:include page="../common/header.jsp"/>
<div class="left_block">
<jsp:include page="../common/twitter.jsp">
	<jsp:param name="title" value="${convention.conventionName}"/>
	<jsp:param name="search" value="${convention.hashTag}"/>
	<jsp:param name="hashTag" value="${convention.hashTag}"/>
</jsp:include>
</div>
<html:errors/>

<div class="center_block">
	<div class="convention_info_block">
		<div class="convention_info">
			<span class="convention_name">【${f:h(convention.conventionName)}】</span>
			<br/>
			<span class="convention_owner_name">(オーナー：<a href="http://twitter.com/${f:h(convention.member.twitterScreenName)}" target="_blank"><img src="${convention.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(convention.member.twitterName)}</a>)</span>
			<c:if test="${ownerFlag}">
				<s:link href="edit/${convention.conventionId}">編集</s:link>
				<s:link href="matching/${convention.conventionId}">マッチング</s:link>
			</c:if>
		</div>
		<div class="convention_info">
			<span class="convention_date">開催日時：<fmt:formatDate value="${convention.conventionDate}" pattern="yyyy/MM/dd HH:mm" /></span>
		</div>
		<div class="convention_info">
			<c:choose>
			<c:when test="${convention.endState == 1}">
				<span class="convention_end_state">終了条件：${endStateMap[convention.endState]}</span>${convention.endWinCount}回
			</c:when>
			<c:when test="${convention.endState == 2}">
				<span class="convention_end_state">終了条件：${endStateMap[convention.endState]}</span>${convention.endLimitTimeMin}分
			</c:when>
			</c:choose>
		</div>
		<div class="convention_info">
			<span class="infomation">${message}</span>
		</div>
		<div class="convention_info">
			<span class="twitter_hash_tag">twitter：<a href="http://twitter.com/search?q=%23${f:h(convention.hashTag)}" target="_blank">#${f:h(convention.hashTag)}</a></span>
		</div>
		<div id="PlagOpen1">
			<p><a href="#" title="commnetOpen" onclick="showPlagin(1);return false;">詳細を開く</a></p>
		</div>
		<div id="PlagClose1" style="display:none">
			<p><a href="#" title="commentClose" onclick="showPlagin(1);return false">詳細を閉じる</a></p>
			<pre>${f:h(convention.conventionComment)}</pre>
		</div>
	</div>

	<div class="during_battle_convention_log_block">
	<span class="menu_title">対戦マッチ一覧</span>
	<table id="during_battle_convention_logs">
	<c:forEach var="e" varStatus="s" items="${duringBattleConventionLogs}">
		<tr>
			<!--<td>
				<fmt:formatDate value="${e.entryDate}" pattern="yyyy-MM-dd HH:mm" />
			</td>-->
			<td>
				<a href="http://twitter.com/${f:h(e.conventionMember1st.member.twitterScreenName)}" target="_blank"><img src="${e.conventionMember1st.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.conventionMember1st.member.twitterName)}</a>
			 	VS <a href="http://twitter.com/${f:h(e.conventionMember2nd.member.twitterScreenName)}" target="_blank"><img src="${e.conventionMember2nd.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.conventionMember2nd.member.twitterName)}</a>
			</td>
			<td>
				<c:if test="${myMatchingConventionLogId == e.conventionLogId || ownerFlag}">
					<s:link href="/conventionLog/${e.conventionLogId}">結果記入</s:link>
				</c:if>
			</td>
		</tr>
	</c:forEach>
	</table>
	</div>

	<div class="convention_member_block">
	<span class="menu_title">大会参加者一覧</span>
	<table id="convention_members">
	<c:forEach var="e" varStatus="s" items="${conventionMemberDtos}">
		<tr>
			<td><a href="http://twitter.com/${f:h(e.twitterScreenName)}" target="_blank"><img src="${e.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.twitterName)}</a></td>
			<td>${f:h(e.friendCode)}</td>
			<td>
				<c:choose>
				<c:when test="${myConventionMemberId == e.conventionMemberId || ownerFlag}">
					<c:if test="${e.activeFlag}">
						<s:link href="/conventionMember/registActiveFlag/${e.conventionMemberId}/${e.conventionId}/${e.version}/false"><span class="convention_active">アクティブ</span></s:link>
					</c:if>
					<c:if test="${!e.activeFlag}">
						<s:link href="/conventionMember/registActiveFlag/${e.conventionMemberId}/${e.conventionId}/${e.version}/true"><span class="convention_passive">パッシブ</span></s:link>
					</c:if>
				</c:when>
				<c:otherwise>
					<c:if test="${e.activeFlag}">
						<span class="convention_active">アクティブ</span>
					</c:if>
					<c:if test="${!e.activeFlag}">
						<span class="convention_passive">パッシブ</span>
					</c:if>
				</c:otherwise>
				</c:choose>
			</td>
		</tr>
	</c:forEach>
	</table>
	</div>

	<div class="end_battle_convention_log_block">
	<div id="PlagOpen2">
		<p><a href="#" title="commnetOpen" onclick="showPlagin(2);return false;">対戦結果一覧を開く</a></p>
	</div>
	<div id="PlagClose2" style="display:none">
		<p><a href="#" title="commentClose" onclick="showPlagin(2);return false">対戦結果一覧を閉じる</a></p>
		<jsp:include page="../common/paging.jsp"></jsp:include>
		<table id="end_battle_convention_logs">
		<c:forEach var="e" varStatus="s" items="${endBattleConventionLogs}">
			<tr>
				<td>
					<c:if test="${e.winConventionMember != null}">
						<a href="http://twitter.com/${f:h(e.conventionMember1st.member.twitterScreenName)}" target="_blank"><img src="${e.conventionMember1st.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.conventionMember1st.member.twitterName)}</a>
						 VS <a href="http://twitter.com/${f:h(e.conventionMember2nd.member.twitterScreenName)}" target="_blank"><img src="${e.conventionMember2nd.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.conventionMember2nd.member.twitterName)}</a>
						 は、<a href="http://twitter.com/${f:h(e.winConventionMember.member.twitterScreenName)}" target="_blank"><img src="${e.winConventionMember.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.winConventionMember.member.twitterName)}</a>が勝利しました。
					</c:if>
					<c:if test="${e.winConventionMember == null}">
						<a href="http://twitter.com/${f:h(e.conventionMember1st.member.twitterScreenName)}" target="_blank"><img src="${e.conventionMember1st.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.conventionMember1st.member.twitterName)}</a>
						 VS <a href="http://twitter.com/${f:h(e.conventionMember2nd.member.twitterScreenName)}" target="_blank"><img src="${e.conventionMember2nd.member.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.conventionMember2nd.member.twitterName)}</a>
						 は、パスされました。
					</c:if>
				</td>
				<td>
					<c:if test="${ownerFlag}">
						<s:link href="/conventionLog/${e.conventionLogId}">結果訂正</s:link>
					</c:if>
				</td>
			</tr>
		</c:forEach>
		</table>
		</div>
	</div>

	<c:if test="${loginFlag && !entryFlag}">
		<s:link href="/conventionMember/insert/${convention.conventionId}" onclick="return confirm('エントリーしてよろしいですか？');"> エントリー </s:link>
	</c:if>
</div>

<div class="right_block">
	<span class="menu_title"></span>
	<table id="convention_rank">
	<c:forEach var="e" varStatus="s" items="${conventionMemberDtos}">
		<tr>
			<td>${s.count}</td>
			<td><a href="http://twitter.com/${f:h(e.twitterScreenName)}" target="_blank"><img src="${e.twitterProfileImageUrl}" width="16" height="16"/>${f:h(e.twitterName)}</a></td>
			<td>${e.winCount} / ${e.battleCount}</td>
		</tr>
	</c:forEach>
	</table>
</div>

</body>
</html>